{extend name="admin@public/base" /}
{block name="main-content"}
	<div class="page-content">
		<!--主题-->
		<div class="page-header">
			<h1>
				您当前操作
				<small>
					<i class="ace-icon fa fa-angle-double-right"></i>
					修改文章
				</small>
			</h1>
		</div>
		<div class="row">
			<div class="col-xs-12">
				<form class="form-horizontal ajaxForm2" name="form0" method="post" action="{:url('admin/News/news_runedit')}"  enctype="multipart/form-data">
					<input type="hidden" name="n_id" id="n_id" value="{$news_list.n_id}" />

					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章所属主栏目： </label>
						<div class="col-sm-10">
							<select name="news_columnid"  class="col-sm-3 " required>
								<option value="">请选择所属栏目</option>
								{foreach name="menu" item="vo"}
									<option value="{$vo.id}"  {if condition="$vo.id eq $news_list['news_columnid']"} selected {/if} {if condition="$vo.menu_type eq 1"}disabled class="bgccc"{else/}class="bgc"{/if}>{$vo.lefthtml}{$vo.menu_name}({if condition="$vo.menu_l eq 'zh-cn'"}中{else /}英{/if}) {if condition="$vo.menu_type eq 1"}(频道页){/if}</option>
								{/foreach}
							</select>
						</div>
					</div>
					<div class="space-4"></div>
					

					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章名称：  </label>
						<div class="col-sm-10">
							<input type="text" name="news_title" id="news_title"  value="{$news_list.news_title}"   class="col-xs-10 col-sm-6" required/>
							<input type="text" name="news_titleshort" id="news_titleshort"  value="{$news_list.news_titleshort}" placeholder="简短标题，建议6~12字数" class="col-xs-10 col-sm-4" style="margin-left:10px;" />
                                            <span class="help-inline col-xs-12 col-sm-7">
												<span class="middle" id="resone"></span>
											</span>
						</div>
					</div>
					<div class="space-4"></div>

					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章属性：  </label>
						<div class="checkbox">
							{foreach name='diyflag' item='diyflag'}
								<label id="news_flag_{$diyflag.diyflag_value}">
									<input {if condition="strstr($news_list['news_flag'],$diyflag['diyflag_value']) eq true"}checked{/if} class="ace ace-checkbox-2" name="news_flag[]" type="checkbox" id="news_flag_va{$diyflag.diyflag_value}" value="{$diyflag.diyflag_value}" />
									<span class="lbl"> {$diyflag.diyflag_name}</span>
								</label>
							{/foreach}
						</div>
					</div>
					<div class="space-4"></div>
					<div class="form-group" id="pptaddress">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 跳转地址：  </label>
						<div class="col-sm-10">
							<input type="text" name="news_zaddress" id="news_zaddress"  value="{$news_list.news_zaddress}"   placeholder="输入页面跳转地址" class="col-xs-10 col-sm-6" />
                                            <span class="help-inline col-xs-12 col-sm-6">
												<span class="middle">正确格式：http:// 开头</span>
											</span>
						</div>
					</div>
					<div class="form-group" id="cpprice">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 产品价格：  </label>
						<div class="col-sm-10">
							<input type="number" name="news_cpprice" id="news_cpprice"  value="{$news_list.news_cpprice}"   placeholder="输入产品价格" class="col-xs-10 col-sm-6" />
						</div>
					</div>
					<div class="space-4"></div>

					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章关键字：  </label>
						<div class="col-sm-10">
							<input type="text" name="news_key" id="news_key"  value="{$news_list.news_key}"  placeholder="输入文章关键字，以英文,逗号隔开" class="col-xs-10 col-sm-6" />
						</div>
					</div>
					<div class="space-4"></div>

					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章来源：  </label>
						<div class="col-sm-10">
							<input type="text" name="news_source" id="news_source"  value="{$news_list.news_source}" class="col-xs-10 col-sm-2" />
							<label class="input_last">
								常用：
								{volist name="source" id="k"}
									<a class="btn btn-minier btn-yellow" href="javascript:;" onclick="return souadd('{$k.source_name}');" >{$k.source_name}</a>&nbsp;
								{/volist}
							</label>
						</div>
					</div>
					<div class="space-4"></div>

					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 封面图片上传： </label>
						<div class="col-sm-10">
							<input type="hidden" name="checkpic" id="checkpic" value="{$news_list.news_img}" />
							<input type="hidden" name="oldcheckpic" id="oldcheckpic" value="{$news_list.news_img}" />
							<a href="javascript:;" class="file" title="点击选择所要上传的图片">
								<input type="file" name="pic_one[]" id="file0" multiple="multiple"/>
								选择上传文件
							</a>
							<span class="lbl">&nbsp;&nbsp;<img src="{$news_list.news_img|get_imgurl}" width="100" height="70" id="img0" ></span>&nbsp;&nbsp;<a href="javascript:;" onclick="return backpic('{$news_list.news_img|get_imgurl}');" title="还原修改前的图片" class="file">
							撤销修改
							</a>
											<span class="lbl">&nbsp;&nbsp;上传前先用PS处理成等比例图片后上传，默认比例100*70、600*420、800*560像素<br />
</span>
						</div>
					</div>
					<div class="space-4"></div>


					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章图集： </label>
						<div class="col-sm-10">
							<div class="radio" >
								<label>
									<input name="news_pic_type" {if condition="$news_list['news_pic_type'] eq 1"}checked{/if} id="news_pic_list" checked type="radio" class="ace" value="1"/>
									<span class="lbl"> 无图模式</span>
								</label>
								<label>
									<input name="news_pic_type" {if condition="$news_list['news_pic_type'] eq 2"}checked{/if} id="news_pic_qqlist" type="radio" class="ace" value="2"/>
									<span class="lbl"> 多图模式</span>
								</label>
								{if condition="$news_list['news_pic_type'] eq 2"}
									<label>
										<span class="btn btn-minier btn-success"  data-toggle="modal" data-target="#myModal">查看已上传的图片</span>
									</label>
								{/if}
							</div>
						</div>
					</div>
					<div class="space-4"></div>
					<link href="__PUBLIC__/ppy/css/fileinput.css" media="all" rel="stylesheet" type="text/css" />
                    <script src="__PUBLIC__/ppy/js/fileinput.js" type="text/javascript"></script>
                    <script src="__PUBLIC__/ppy/js/fileinput_locale_zh.js" type="text/javascript"></script>
					<div class="form-group" id="pic_list" {if condition="$news_list['news_pic_type'] eq 1"}style="display:none"{/if}>
						<div class="col-sm-10 col-sm-offset-2" style="padding-top:5px;">
							<input id="file-5" name="pic_all[]" type="file" class="file"  multiple data-preview-file-type="any" data-upload-url="#" data-preview-file-icon=""><br />
							<textarea name="news_pic_content" class="col-xs-12 col-sm-12" id="news_pic_content"  placeholder="单次编辑或添加文章,选择多图时请一次性选择。多图对应文章说明，例如： 图片一说明 | 图片二说明 | 图片三说明    每个文字说明以 | 分割" >{$news_list['news_pic_content']}</textarea>
						</div>
					</div>
					<div class="space-4"></div>
					<!--老多图字符串-->
					<input name="pic_oldlist" type="hidden" id="pic_oldlist" type="text" size="130" value="{$news_list.news_pic_allurl}" >
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 是否审核： </label>
						<div class="col-sm-10" style="padding-top:5px;">
							<input name='news_open' id='news_open' {if condition="$news_list['news_open'] eq 1"}checked{/if}  value='1' class='ace ace-switch ace-switch-4 btn-flat' type='checkbox' />
							<span class="lbl">&nbsp;&nbsp;默认关闭</span>
						</div>
					</div>
					<div class="space-4"></div>

					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 排序（从小到大）： </label>
						<div class="col-sm-10">
							<input type="text" name="listorder" value="{$news_list['listorder']|default=50}" class="col-xs-10 col-sm-1" />
						</div>
					</div>
					<div class="space-4"></div>

					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 显示日期：  </label>
						<div class="col-sm-10">
							<input name="showdate" class="date-picker col-xs-10 col-sm-6" value="{$news_extra['showdate']|date='Y-m-d',###}" type="text" data-date-format="yyyy-mm-dd">
							<span class="lbl">&nbsp;&nbsp;默认为文章添加日期</span>
						</div>
					</div>
					<div class="space-4"></div>
					
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章简介： </label>
						<div class="col-sm-9">
							<input type="text" name="news_scontent" id="news_scontent" class="col-xs-10 col-sm-10"  maxlength="100" value="{$news_list.news_scontent}"  placeholder="输入文章简介"  />
							<label class="input_last">已限制在100个字以内</label>
						</div>
					</div>
					<div class="space-4"></div>

					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章主内容 </label>
						<div class="col-sm-10">
							<script src="__PUBLIC__/ueditor/ueditor.config.js" type="text/javascript"></script>
							<script src="__PUBLIC__/ueditor/ueditor.all.js" type="text/javascript"></script>
							<textarea name="news_content" rows="100%" style="width:100%" id="myEditor">{$news_list.news_content}</textarea>
							<script type="text/javascript">
								var editor = new UE.ui.Editor();
								editor.render("myEditor");
							</script>
						</div>
					</div>
					<div class="space-4"></div>

					<div class="clearfix form-actions">
						<div class="col-md-offset-3 col-md-9">
							<button class="btn btn-info" type="submit">
								<i class="ace-icon fa fa-check bigger-110"></i>
								保存
							</button>

							&nbsp; &nbsp; &nbsp;
							<button class="btn" type="reset">
								<i class="ace-icon fa fa-undo bigger-110"></i>
								重置
							</button>
						</div>
					</div>
				</div>	
			</form>
		</div>
        <!-- 显示模态框（Modal） -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog" style="width:80%">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"
                                aria-hidden="true">×
                        </button>
                        <h4 class="modal-title" id="myModalLabel">
                            操作已上传的多图
                        </h4>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-xs-12">


                                <div class="form-group">
                                    <div class="col-sm-10">
                                        <ul>
                                            {volist name="pic_list" id="v"}

                                                <div class="file-preview-frame" data-fileindex="0" id="id{$i}">
                                                    <img src="{$v|get_imgurl}" class="file-preview-image" style="width:auto;height:160px;">
                                                    <div class="file-thumbnail-footer">
                                                        <div class="file-actions">
                                                            <div class="file-footer-buttons">
                                                                <a class="red" href="javascript:;" onclick="return delall({$i},'{$v}');" title="回收站">
                                                                    <i class="ace-icon fa fa-trash-o bigger-130"></i>
                                                                </a>
                                                            </div>
                                                            <div class="clearfix"></div>
                                                        </div>
                                                    </div>
                                                </div>
                                            {/volist}
                                        </ul>
                                    </div>
                                </div>

                                <div class="space-4"></div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button class="btn btn-primary">
                            若想取消修改，请刷新当前页面
                        </button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">
                            关闭
                        </button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->
	</div>
{/block}
{block name="scripts"}
	<script>
        $("#news_pic_list").click(function(){
            $("#pic_list").hide();
        });
        $("#news_pic_qqlist").click(function(){
            $("#pic_list").show();
        });
        if(!$("#news_flag_vaj").attr("checked")){
            $("#pptaddress").hide();
        }
        $("#news_flag_vaj").click(function(){
            $("#pptaddress").toggle(400);
        });
        if(!$("#news_flag_vacp").attr("checked")){
            $("#cpprice").hide();
        }
        $("#news_flag_vacp").click(function(){
            $("#cpprice").toggle(400);
        });
		$('.date-picker').datepicker({
				autoclose: true,
				todayHighlight: true,
				language:'zh-CN',
			})
	</script>
{/block}
